package org.jeecg.modules.user.notice.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.user.notice.service.NoticeService;
import org.jeecg.modules.utils.BikeResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@Api(tags="公告")
@RestController
@RequestMapping("/app/notice")
@Slf4j
public class NoticeController {

    @Autowired
    private NoticeService noticeService;

    /**
     * @param  type 类型（2:系统消息，3:服务通知，4骑行首页公告信息，5:主页新闻， 6 运维公告  8.app骑行首页轮播图
     * */
    @ApiOperation(value="app公告", notes="app公告")
    @RequestMapping(value = "/getNoticeList", method = RequestMethod.GET)
    public BikeResult getNoticeList(@RequestParam("type") Integer type,@RequestParam(value = "id",required = false)String id, @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize,HttpServletRequest request) {
        return noticeService.getNoticeList(type,id,pageNum,pageSize,request);
    }

    @ApiOperation(value="app系统消息", notes="app系统消息")
    @RequestMapping(value = "/getSysMessage", method = RequestMethod.GET)
    public BikeResult getSysMessage( @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize,HttpServletRequest request) {
        return noticeService.getSysMessage(pageNum,pageSize,request);
    }
    @ApiOperation(value="未读消息提示", notes="未读消息提示")
    @RequestMapping(value = "/getIconCount", method = RequestMethod.GET)
    public BikeResult getIconCount(HttpServletRequest request) {
        return noticeService.getIconCount(request);
    }
}
